<template>
  <div style="height: 100%;display: flex;flex-direction: column;align-items: center;    margin-top: 100px;">
    <div>
      <img src="https://cdn.pixabay.com/photo/2017/10/10/19/55/emoji-2838557_640.png" style="width: 160px;">
    </div>
    <h3>我们不想看到您离开我们。但是如果您仍然决定离开，我们希望您备份您所有有价值的数据和帐户信息等等。</h3>
    <div style="margin-top: 100px;">
      <el-button type="danger" @click="deleteHandler">关闭账户</el-button>
    </div>
  </div>
</template>

<script>
import {toSignOut} from "@/utils/autoSignOut";

export default {
  name: "DeleteAccount",
  methods: {
    deleteHandler () {
      this.$confirm("您确定关闭账户，并清空机构中所有数据吗", this.$t('loc.tip'), {
        confirmButtonText: this.$t('loc.closeAcc'),
        cancelButtonText: this.$t('loc.close'),
        type: 'warning',
      }).then(() => {
        $axios.get($api.urls().accountDelete, {params: {key: 'kkk'}})
            .then(response => {
              toSignOut()
            }).catch(error => {
          this.$message.error(error.response.data.description)
        })
      }).catch((error) => {
        console.log(error)
        this.$message.error(error.response.data.description)
      });

    }
  }
}
</script>

<style scoped>

</style>